<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

//前台无限制调用
Route::group(['namespace' => 'Front', 'middleware' => []], function () {

    //省市区
    Route::get('area','AreaController@index');
    //支付宝异步回调
    Route::post('pay/callback/alipay_server','PayController@aliPayServerBack');

    //通联支付异步回调
    Route::post('pay/callback/allinpay_server','PayController@allinPayServiceBack');
    Route::post('pay/callback/allinpay','PayController@allinPayRedirectBack');       //通联支付同步回调

    //微信支付异步回调
    // Route::post('pay/callback/wxpay_server','PayController@wxPayServerBack');
    Route::post('pay/callback/wxpay_server','PayController@wxPayServerBack');
    Route::post('pay/wxpay/order_query/{order_sn}/{return_type}','PayController@wxpayOrderQuery');                   //根据订单id查询微信的支付结果

    //平安支付异步回调
    // Route::post('pay/callback/pinganpay_server','PayController@pingAnServerBack');
    Route::post('pay/callback/pinganpay_server/{order_id}','PayController@pingAnServerBack');                       //平安支付异步回调
    Route::post('pay/callback/pinganpay/{order_id}','PayController@pingAnPayRedirectBack');                         //平安支付同步回调
    Route::get('pinganpay/pingan_single_order_query/{pay_num}','PayController@pingAnSingleOrderQuery');             //平安支付订单查询
    Route::get('pinganpay/pingan_single_order_refund/{order_id}','PayController@pingAnSingleOrderRefund');          //平安支付退款申请
    Route::post('pay/callback/pingan_refund_server/{order_id}','PayController@pingAnRefundServer');                 //平安支付退款异步通知
    Route::get('pinganpay/pingan_refund_query/{start_time}/{end_time}','PayController@pingAnRefundQuery');          //平安支付退款查询
    Route::get('pinganpay/pingan_send_msg/{telphone}','PayController@pingAnSendMsg');                               //平安支付实名认证发送验证码
    Route::get('pinganpay/identity_verification','PayController@identityVerification');                      //平安支付实名认证
    // Route::post('pay/success/{id}','PayController@success');//支付成功

    // 平安银行快捷支付
    // Route::resource('pingan', 'PingAnController');
    Route::get('pingan/unionApiOpen','PingAnController@unionApiOpen');                      //平安银行快捷支付-开通
    Route::get('pingan/unionApiOpened','PingAnController@unionApiOpened');                  //平安银行快捷支付-已开通银行卡列表查询
    Route::get('pingan/unionApiSsms/{order_id}/{open_id}','PingAnController@unionApiSsms');                  //平安银行快捷支付-获取支付短信验证码
    Route::get('pingan/unionApiSubmit/{order_id}','PingAnController@unionApiSubmit');                  //平安银行快捷支付-发起后台支付交易



    // Route::resource('my/coupon', 'MyCouponController');      //我的优惠券
    //Route::post('my/coupon/statisticsCount', ['uses'=>'MyCouponController@statisticsCount', 'as'=>'my.coupon.statisticsCount']);      //根据查询条件统计优惠券数量
    // Route::resource('coupon', 'CouponController');      //优惠券
    Route::get('download','DownloadController@download');
    // Route::resource('address_xml', 'AddressXMLController');      //生成地址xml

    // Route::post('my/coupon/activation_pwd/{password}', ['uses'=>'MyCouponController@activationPwd', 'as'=>'my.coupon.activation_pwd']);      //激活优惠口令

});


//前台
Route::group(['domain' => config('domain.pc'),'namespace' => 'Front', 'middleware' => ['csrf']], function () {


    Route::resource('file_upload', 'FileUploadController');
    //会员登录
    Route::get('user/login', 'UserController@login');
    Route::post('user/login', 'UserController@loginOk');
    Route::get('captcha/{tmp}', 'UserController@captcha');
    Route::post('user/sms', 'UserController@sms');
    Route::post('email/send','UserController@sendEmail');
    //社会化登陆
    Route::get('user/socialiteLogin/{name}', 'UserController@socialiteLogin');
    Route::get('user/socialite/callback/{name}', 'UserController@socialiteCallback');

    Route::resource('/my/forgetPwd', 'FindPwdController');//忘记密码
    Route::post('/my/forgetPwd/find', ['as'=>'my.forgetPwd.find_pwd','uses'=>'MyAccountController@forgetPwd']);//找回密码
    Route::post('/my/sms', 'MyAccountController@sms');


    //会员注册
    Route::get('user/logout', 'UserController@logout');
    Route::get('user/register', 'UserController@register');
    Route::post('user/register', 'UserController@registerOk');
    Route::post('user/checkUser', 'UserController@checkUser');


    //前台游客页面
    Route::get('/', ['uses'=>'HomeController@index','as'=>'home']);//首页
    Route::get('cat/{id}', 'CatController@index');//频道页面
    Route::get('category/{id}', 'CategoryController@index');//频道页面
    Route::get('search', 'SearchController@index');//分类页面
    Route::get('search/suggestion', 'SearchController@suggestion');//搜索提示
    Route::get('goods/{id}', ['uses'=>'GoodsController@show', 'as'=>'front.goods.detail']);//商品详情页
    Route::post('goods/comment','GoodsController@comment');//获取商品评论
    Route::get('activity/{id}','ActivityController@index');//活动专题页面
    //Route::post('cart/payagain','CartController@payagain');//再次购买
    Route::resource('cart','CartController');//购物车页面
    Route::post('cart/getGoodsInfo/{id}','CartController@getGoodsInfo');//购物车页面
    Route::resource('shop','ShopController');//商铺页面
    //Route::resource('test','TestController');
Route::get('goods/attribut_value_redirect/{good_id}', ['uses' => 'GoodsController@attributValueRedirect', 'as' => 'admin.goods.attributValueRedirect']);  //根据商品中的选择的属性跳转到新的商品
    Route::get('goods/attribut_value_redirect/{good_id}', ['uses' => 'GoodsController@attributValueRedirect', 'as' => 'admin.goods.attributValueRedirect']);  //根据商品中的选择的属性跳转到新的商品
    Route::resource('coupon', 'CouponController');      //优惠券

    //前台需登录处理页面
    Route::group(['middleware' => ['user']], function () {


        Route::resource('my/collection','UserCollectionController@index');//首页我的收藏
        Route::get('my/view_history', 'MyViewHistoryController@index');        //浏览记录
        Route::resource('/my/user_info', 'MyInfoController@index');//个人信息
        Route::get('/my/account_safe', 'MyAccountController@index'); //账号安全
        Route::put('/my/account_safe', ['as'=>'my.account_safe.resetPaw','uses'=>'MyAccountController@resetPaw']); //修改密码
        Route::post('my/order/search', 'MyOrderController@search');//查询订单
        Route::resource('my/order', 'MyOrderController');//我的订单
        Route::post('my/order/combinePayOrder', 'MyOrderController@combinePayOrder');//我的订单合并支付
        Route::post('my/order/payOrder', 'MyOrderController@payOrder');//我的订单立即支付
        Route::post('my/order/cancelOrder', 'MyOrderController@cancelOrder');//我的订单取消订单
        Route::post('my/order/receiveGoods', 'MyOrderController@receiveGoods');//我的订单确认收货
        Route::post('my/order/payagain', 'MyOrderController@payagain');//我的订单确再次购买
        Route::post('my/order/remind','MyOrderController@remind');//我的订单提醒发货订单
        Route::post('my/order/refund','MyOrderController@refund');//我的订单申请退款
        //Route::post('my/commentPicture', 'MyCommentController@savePicture');//保存评论图片
        Route::resource('my/comment', 'MyCommentController');
        Route::resource('my/address', 'MyAddressController');        //收货地址
        Route::resource('my/collection','UserCollectionController');
        Route::resource('my/center','MyHomeController@index');
        Route::resource('my/cancel','MyCancelController@index');

        Route::post('cart/pay','CartController@pay');//结算
        Route::post('cart/fast_pay','CartController@fastPay');//单个结算

        Route::resource('order','OrderController');//订单

        Route::get('pay/{order_id}','PayController@index');
        Route::get('pay/success/{id}','PayController@success');//支付成功
        Route::get('pay/fail/{id}','PayController@fail');//支付成功
        Route::get('pay/request/{order_id}/{type}','PayController@request');
        Route::get('pay/callback/alipay','PayController@aliPayRedirectBack');
        //Route::post('pay/callback/allinpay','PayController@allinPayRedirectBack');       //通联支付同步回调
        Route::get('pay/request/wxpay/sacn_url/{order_id}','PayController@wxpayScanUrl');                  //获取订单的微信支付地址
        // Route::post('pay/wxpay/order_query/{order_sn}/{return_type}','PayController@wxpayOrderQuery');                   //根据订单id查询微信的支付结果

        Route::get('my/refund/apply/{order_sn}/{goods_id}', ['uses'=>'MyRefundGoodsController@apply','as'=>'my.refund.apply']);       //订单商品退货申请页面
        Route::get('my/refund/record', ['uses'=>'MyRefundGoodsController@record','as'=>'my.refund.record']);                          //订单商品退货记录
        //Route::get('my/refund/detail', ['uses'=>'MyRefundGoodsController@detail','as'=>'my.refund.detail']);      //售后（退款）明细
        Route::resource('my/refund', 'MyRefundGoodsController');      //订单商品退货
        Route::get('goods/archive/{order_sn}/{goods_id}', ['uses'=>'GoodsController@goodsArchive', 'as'=>'front.goods.archive']);//订单商品快照

        Route::resource('my/coupon', 'MyCouponController');      //我的优惠券
        Route::post('my/coupon/statisticsCount', ['uses'=>'MyCouponController@statisticsCount', 'as'=>'my.coupon.statisticsCount']);      //根据查询条件统计优惠券数量
        Route::post('my/coupon/activation_pwd/{password}', ['uses'=>'MyCouponController@activationPwd', 'as'=>'my.coupon.activation_pwd']);      //激活优惠口令

        Route::post('discount/get_user_can_use_discount', ['uses'=>'DiscountController@getUserCanUseDiscount', 'as'=>'discount.get_user_can_use_discount']);      //根据要购买的商品数组获取用户购买这些商品时可用的限时折扣


        Route::post('user/hasIdVerity', 'UserController@hasIdVerity');          //查询用户是否实名认证
        Route::post('user/addIdVerity', 'UserController@addIdVerity');          //增加用户实名信息

    });


    //帮助
    Route::controllers(['help'=>'HelpController']);



});

//移动WEB
Route::group(['domain' => config('domain.mobile')], function () {

    //MOBILE
    Route::group(['namespace' => 'Mobile'], function () {


        //帮助
        Route::controllers(['help'=>'HelpController']);
        Route::post('file_upload','FileUploadController@store'); //上传文件
        Route::get('/', 'HomeController@index');//首页
        Route::post('/get_goods', 'HomeController@getGoods');//首页爆品推荐商品

        Route::resource('cat', 'CatController');//分类
        Route::post('/get_cat_goods', 'CatController@getCatGoods');//获取分类页商品

        Route::get('search', 'SearchController@index');//搜索页
        Route::get('search/result', ['uses'=>'SearchController@result', 'as'=>'mobile.search.result']);//搜索结果页
        Route::post('search/result','SearchController@getResult');//获取搜索结果

        Route::post('user/sms', 'UserController@sms');
        Route::post('user/sendSms', 'UserController@sendSms');
        Route::get('captcha/{tmp}', 'UserController@captcha');

        Route::get('user/register', 'UserController@reg');
        //Route::post('user/register', 'UserController@regOk');
        Route::post('user/register', 'UserController@register');
        Route::get('user/regsuccess', 'UserController@regsuccess');

        Route::post('user/logout', 'UserController@logout');
        Route::get('user/login', 'UserController@login');
        Route::post('user/login', 'UserController@loginOk');

        Route::get('user/find_password', 'UserController@findPassword');
        Route::post('user/check_step', 'UserController@checkStep');

        Route::get('activity/{id}', 'ActivityController@index');//手机端
        Route::get('activity/detail/{id}', 'ActivityController@detail');//pc端
        Route::post('/get_activity_goods', 'ActivityController@getActivityGoods');//pc端获取活动商品

        Route::get('goods/{id}', 'GoodsController@detail');//手机端
        Route::get('goods/show/{id}', 'GoodsController@index');//pc端商品详情
        Route::get('goods/comment/{id}', 'GoodsController@comment');//pc端商品评价
        Route::post('goods/get_comment', 'GoodsController@getcomment');//获取商品评价
        Route::post('goods/get_redirect_goods/{goods_id}', 'GoodsController@getRedirectGoods');//根据规格定位商品
        Route::get('goods/coupon/{goods_id}', 'GoodsController@coupon');//商品可以领取的优惠券页面
        Route::get('goods/sn/{goods_sn}', 'GoodsController@goodsRedirect');
        Route::post('area', 'AreaController@index');//地址


        Route::get('shop/{id}','ShopController@index');//商铺页
        Route::post('shop/get_goods','ShopController@getShopGoods');//获取商铺商品

        //购物车
        Route::resource('cart', 'CartController');
        Route::post('cart/getGoodsInfo/{id}','CartController@getGoodsInfo');//购物车页面


        //登录
        //Route::resource('login', 'LoginController');
        Route::group(['middleware' => ['user']], function (){
            //购物车
            Route::post('cart/settlement','CartController@settlement');//结算购物车
            // Route::get('cart/settlement','CartController@settlement');//结算购物车
            Route::post('cart/fast_settlement','CartController@fastSettlement');//单个商品快速结算

            //订单
            Route::resource('order', 'OrderController');

            //支付
            Route::get('pay/{order_id}','PayController@index');
            Route::get('pay/success/{id}','PayController@success');//支付成功
            Route::get('pay/request/{order_id}/{type}','PayController@request');
            Route::get('pay/callback/alipay','PayController@aliPayRedirectBack');
            //Route::post('pay/callback/allinpay','PayController@allinPayRedirectBack');       //通联支付同步回调
            Route::get('pay/request/wxpay/sacn_url/{order_id}','PayController@wxpayScanUrl');                  //获取订单的微信支付地址
            // Route::post('pay/wxpay/order_query/{order_sn}/{return_type}','PayController@wxpayOrderQuery');                   //根据订单id查询微信的支付结果

            //我的订单
            Route::get('my/order/search', 'MyOrderController@search');//查询订单
            Route::resource('my/order', 'MyOrderController');
            Route::post('my/get_order', 'MyOrderController@getOrder');//下拉获取订单
            Route::post('my/order/cancelOrder', 'MyOrderController@cancelOrder');//我的订单取消订单
            Route::post('my/order/receiveGoods', 'MyOrderController@receiveGoods');//我的订单确认收货
            Route::post('my/order/remind','MyOrderController@remind');//我的订单提醒发货订单
            Route::post('my/order/payagain', 'MyOrderController@payagain');//我的订单再次购买

            //订单商品退货
            Route::get('wap/my/refund/apply/{order_sn}/{goods_id}', ['uses'=>'MyRefundGoodsController@apply','as'=>'wap.my.refund.apply']);       //订单商品退货申请页面
            Route::get('wap/my/refund/record', ['uses'=>'MyRefundGoodsController@record','as'=>'wap.my.refund.record']);                          //订单商品退货记录
            //Route::get('wap/my/refund/detail', ['uses'=>'MyRefundGoodsController@detail','as'=>'wap.my.refund.detail']);      //售后（退款）明细
            Route::resource('wap/my/refund', 'MyRefundGoodsController');      //订单商品退货
            Route::get('goods/archive/{order_sn}/{goods_id}', ['uses'=>'GoodsController@goodsArchive', 'as'=>'mobile.goods.archive']);//订单商品快照
            //收货地址
            Route::resource('my/address', 'MyAddressController');

            //优惠券
            Route::resource('my/coupon', 'MyCouponController');
            Route::post('my/coupon/activation_pwd/{password}', ['uses'=>'MyCouponController@activationPwd', 'as'=>'wap.my.coupon.activation_pwd']);      //激活优惠口令


            Route::resource('user', 'UserController');//个人中心
            Route::get('collection', 'CollectionController@index');//收藏
            Route::post('collection/get', 'CollectionController@getCollection');//获取收藏
            Route::post('collection/add', 'CollectionController@addCollection');//添加收藏
            Route::post('collection/cancel', 'CollectionController@cancelCollection');//取消收藏

            Route::get('setting', 'UserController@setting');//设置
            Route::get('setting/reset_password', 'UserController@resetPassword');//修改密码
            Route::post('setting/resetOk', 'UserController@resetOk');//修改密码
            //评论
            Route::resource('comment','CommentController');//待评论商品页
            Route::post('comment/add_comment','CommentController@addComment');//订单评论

            // Route::get('goods/{id}', ['uses'=>'GoodsController@show', 'as'=>'mobile.goods.detail']);//商品详情页

        });

    });

});


//Route::get('pay','PayController@aliPay');

//后台路由
//Route::get('admin/login', 'LoginController@login');//后台登录
Route::resource('admin/login', 'Admin\LoginController', ['only' => ['index', 'store', 'destroy']]);//后台登录
Route::get('admin/captcha/{tmp}', 'Admin\LoginController@captcha');//后台登录验证码

// Route::post('admin/file_upload', 'Admin\FileUploadController@store');

// Route::get('admin/order/push_wxpay/{order_id}','Admin\OrderController@pushWxpay');       //推送微信支付单

//口令优惠券
Route::resource('admin/password_coupon', 'Admin\PasswordCouponController');

//生成口令并且对应优惠券
Route::post('admin/password_coupon/create_pwd/{pwd_num}/{coupon_id}',  ['uses' => 'Admin\PasswordCouponController@createPwds', 'as' => 'admin.password_coupon.create_pwd']);

//获取指定优惠券的口令
Route::post('admin/password_coupon/get_pwds_by_coupon_id',  ['uses' => 'Admin\PasswordCouponController@getPwdsByCouponId', 'as' => 'admin.password_coupon.get_pwds_by_coupon_id']);

//获取未发送过的口令的优惠券列表
Route::post('admin/password_coupon/get_coupon_no_send',  ['uses' => 'Admin\PasswordCouponController@getCouponNoSend', 'as' => 'admin.password_coupon.get_coupon_no_send']);

//发送优惠码给用户
Route::post('admin/password_coupon/send_pwds_to_user',  ['uses' => 'Admin\PasswordCouponController@sendPwdsToUser', 'as' => 'admin.password_coupon.send_pwds_to_user']);


Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => ['admin']], function () {


    Route::get('/', ['as' => 'admin.home', 'uses' => 'HomeController@index']);//后台首页


    Route::post('file_upload', 'FileUploadController@store');
    Route::put('file_upload','FileUploadController@store');


    Route::resource('admin_role', 'AdminRoleController');



    //商品
    Route::post('goods/toggleShow','GoodsController@toggleShow');
    Route::resource('goods', 'GoodsController');
    Route::get('goods/update_one/{good_id}', ['uses' => 'GoodsController@updateOne', 'as' => 'admin.goods.updateOne']);  //商品上下架切换
    Route::put('goods_sort', ['uses' => 'GoodsController@sort', 'as' => 'admin.goods.sort']);  //商品排序
    Route::get('addGoodsToAct/{cat_id}', ['uses' => 'GoodsController@addGoodsToAct', 'as' => 'admin.goods.addGoodsToAct']);  //添加商品到活动
    Route::get('add_goods_to_recommend/{cat_id}', ['uses' => 'GoodsController@addGoodsToRecommend', 'as' => 'admin.goods.addGoodsToRecommend']);  //添加商品到活动
    Route::get('goods/{good_id}/{name}/update_two', ['uses' => 'GoodsController@updateTwo', 'as' => 'admin.goods.updateTwo']);  //商品上下架切换
    Route::get('goods/stock/{good_sn}', ['uses' => 'GoodsController@updateStock', 'as' => 'admin.goods.updateStock']);  //商品库存变动
    //Route::get('goods/is_has_goods/{good_id}', ['uses' => 'GoodsController@isHasGoods', 'as' => 'admin.goods.isHasGoods']);  //判断商品是否存在
    Route::post('goods/batch_storage', ['uses' => 'GoodsController@batchStorage', 'as' => 'admin.goods.batch_storage']);          //批量入库
    Route::post('goods/batch_out_going',['uses' => 'GoodsController@batchOutGoing', 'as' => 'admin.goods.batch_out_going']);        //批量出库
    // Route::get('goods/batch/out_going',['uses' => 'GoodsController@batchOutGoing', 'as' => 'admin.goods.batch_out_going']);        //批量出库
    Route::get('goods/export/goods',['uses' => 'GoodsController@exportGoods', 'as' => 'admin.goods.export_goods']);        //导出批量出库商品excel
    Route::get('goods/get_goods/by_ids', ['uses' => 'GoodsController@getGoodsByIds', 'as' => 'admin.goods.getGoodsByIds']);  //根据商品id数组获取商品信息


    //订单
    Route::get('order/remind','OrderController@remind');       //发货提醒
    Route::get('order/shippingOrder/',['uses'=>'OrderController@shippingOrder','as'=> 'admin.order.shippingOrder']);//待发货订单
    Route::resource('order/notice/','NoticeController');//通知管理
    Route::resource('order', 'OrderController');
    Route::get('order/detail/{order_identification}', ['uses' => 'OrderController@detail', 'as' => 'admin.order.detail']);       //订单详情
    Route::post('order/deliver/{order_id}','OrderController@deliver');       //测试发货
    Route::post('order/push/{order_id}','OrderController@pushTarrif');       //推送海关
    Route::post('order/push_old/{order_id}','OrderController@pushTarrifOld');       //推送海关（旧版）

    //Route::get('push_tarrif/get_status','PushTarrifController@getStatus');       //获取清单状态
    Route::post('order/push_pay/{order_id}','OrderController@pushPay');       //推送支付单
    Route::post('order/refund/{order_id}','OrderController@refund');       //订单退款
    Route::post('order/record/{order_id}','OrderController@record');       //订单备录
    // Route::post('order/push_wxpay/{order_id}','OrderController@pushWxpay');       //推送微信支付单
    Route::resource('push_tarrif','PushTarrifController');       //推送海关订单
    Route::get('order/custom_status/{order_id}','OrderController@getCustomStatus');//获取清关状态
    Route::get('order/order_distribute/{order_id}', ['uses' => 'OrderController@orderDistribute', 'as' => 'admin.order.order_distribute']);   //订单派发
    Route::post('order/update_address/{order_id}','OrderController@orderAddress');//更新订单收货人信息


    //子订单
    Route::get('sub_order_e','SubOrderController@eorder');//E贸易订单
    Route::get('sub_order_c','SubOrderController@corder');//普通订单

    //分类
    Route::get('category/toggleShow/', ['uses' => 'CategoryController@toggleShow', 'as' => 'admin.category.toggleShow']);   //是否展示
    Route::resource('category', 'CategoryController');
    Route::put('category', ['as' => 'admin.category.sort', 'uses' => 'CategoryController@sort']);//扩展排序

    Route::get('user/toggleDisabled/', ['uses' => 'UserController@toggleDisabled', 'as' => 'admin.user.toggleDisabled']);   //是否封禁用户账号
    Route::get('user/get_user', ['uses' => 'UserController@getUser', 'as' => 'admin.user.getUser']);   //获取用户信息
    Route::get('user/get_user_num_by_condition', ['uses' => 'UserController@getUserNumByCondition', 'as' => 'admin.user.get_user_num_by_condition']);   //根据筛选条件获取用户的数量
    Route::resource('user', 'UserController');
    Route::get('add_user_to_role/{role_id}', ['uses' => 'UserController@addUserToRole', 'as' => 'admin.user.addUserToRole']);  //添加用户到角色组

    //活动专题
    Route::post('activity/sort', ['uses' => 'ActivityController@sort', 'as' => 'admin.activity.sort']);
    Route::get('activity/toggleShow/', ['uses' => 'ActivityController@toggleShow', 'as' => 'admin.activity.toggleShow']);   //是否展示
    Route::resource('activity', 'ActivityController');

    //专题分类
    Route::resource('activity_cat', 'ActivityCatController');
    Route::post('activity_cat/sort', ['uses' => 'ActivityCatController@sort', 'as' => 'admin.activity_cat.sort']);
    //Route::resource('activity.activity_cat','ActivityCatController');

    //活动专题商品
    Route::post('activity_goods/sort', ['uses' => 'ActivityGoodsController@sort', 'as' => 'admin.activity_goods.sort']);
    Route::resource('activity_goods', 'ActivityGoodsController');
    //Route::resource('activity/{activity_id}/{activity_cat_id}/goods', 'ActivityGoodsController');

    //推荐位置
    Route::get('recommend_position/toggleShow/', ['uses' => 'RecommendPositionController@toggleShow', 'as' => 'admin.recommend_position.toggleShow']);
    Route::resource('recommend_position', 'RecommendPositionController');

    //推荐
    //Route::put('recommend/sort',['as'=>'admin.recommend.sort','uses'=>'RecommendController@sort']);
    Route::post('recommend/sort', ['uses' => 'RecommendController@sort', 'as' => 'admin.recommend.sort']);
    Route::resource('recommend', 'RecommendController');

    //商铺
    Route::get('shop/toggleShow/', ['uses' => 'ShopController@toggleShow', 'as' => 'admin.shop.toggleShow']);   //是否展示
    Route::post('shop/sort', ['uses' => 'ShopController@sort', 'as' => 'admin.shop.sort']);//排序
    Route::resource('shop', 'ShopController');

    //商品类型
    Route::get('goods_type/toggleEnabled/', ['uses' => 'GoodsTypeController@toggleEnabled', 'as' => 'admin.goods_type.toggleEnabled']);   //是否启用
    Route::resource('goods_type', 'GoodsTypeController');

    //商品属性
    Route::post('goods_attribute/sort', ['uses' => 'GoodsAttributeController@sort', 'as' => 'admin.goods_attribute.sort']);
    Route::resource('goods_attribute', 'GoodsAttributeController');


    //广告
    Route::resource('ad', 'AdController');
    Route::put('ad', ['as' => 'admin.ad.sort', 'uses' => 'AdController@sort']);     //广告排序

    Route::resource('ad_position', 'AdPositionController');

    Route::get('user_point_log/{id}', 'UserPointLogController@show');   //用户积分显示

    Route::get('/', ['as' => 'admin.home', 'uses' => 'HomeController@index']);//后台首页

    //品牌管理
    Route::get('brand/toggleShow/', ['uses' => 'BrandController@toggleShow', 'as' => 'admin.brand.toggleShow']);   //是否展示
    Route::resource('brand', 'BrandController');

    //商品分类下的品牌
    Route::get('categoryBrand/toggleShow/', ['uses' => 'CategoryBrandController@toggleShow', 'as' => 'admin.categoryBrand.toggleShow']);   //是否展示
    Route::resource('categoryBrand', 'CategoryBrandController');
    Route::get('categoryBrand/categoryBrands/{cat_id}', ['uses'=>'CategoryBrandController@categoryBrands','as'=>'admin.categoryBrand.categoryBrands']);
    Route::delete('categoryBrand/delCategoryBrand/{cat_id}/{brand_id}', ['uses'=>'CategoryBrandController@delCategoryBrand','as'=>'admin.categoryBrand.delCategoryBrand']);
    Route::get('categoryBrand/create/{cat_id}', ['uses'=>'CategoryBrandController@create','as'=>'admin.categoryBrand.create']);

    //分类属性管理
    Route::post('categoryAttribute/sort', ['uses' => 'CategoryAttributeController@sort', 'as' => 'admin.categoryAttribute.sort']);
    Route::post('categoryAttribute', ['uses' => 'CategoryAttributeController@store', 'as' => 'admin.categoryAttribute.store']);
    Route::post('categoryAttribute/update/{id}', ['uses' => 'CategoryAttributeController@update', 'as' => 'admin.categoryAttribute.update']);
    Route::get('category/category_attribute/{cat_id}', ['uses'=>'CategoryAttributeController@categoryAttribute','as'=>'admin.category.categoryAttribute']);//产品属性
    Route::delete('categoryAttribute/delCategoryAttribute/{id}', ['uses'=>'CategoryAttributeController@delCategoryAttribute','as'=>'admin.categoryAttribute.delCategoryAttribute']);
    Route::get('category_attribute/create/{cat_id}', ['uses'=>'CategoryAttributeController@create','as'=>'admin.categoryAttribute.create']);
    Route::get('category_attribute/get_attribute',['uses'=>'CategoryAttributeController@getCategoryAttribute','as'=>'admin.categoryAttribute.getCategoryAttribute']);

    //分类属性值管理
    Route::post('categoryAttributeValue/store', ['uses' => 'CategoryAttributeValueController@store', 'as' => 'admin.categoryAttributeValue.store']);
    Route::post('category_attribute_value/update/{id}', ['uses' => 'CategoryAttributeValueController@update', 'as' => 'admin.categoryAttribute.update']);
    Route::get('category_attribute/category_attribute_value', ['uses'=>'CategoryAttributeValueController@categoryAttributeValue','as'=>'admin.categoryAttributeValue.categoryAttributeValue']);//产品属性值
    Route::delete('categoryAttribute/delCategoryAttributeValue/{id}', ['uses'=>'CategoryAttributeValueController@delCategoryAttributeValue','as'=>'admin.categoryAttribute.delCategoryAttributeValue']);
    Route::get('category_attribute_value/create', ['uses'=>'CategoryAttributeValueController@create','as'=>'admin.categoryAttributeValue.create']);

    //商品库存操作日志
    Route::resource('stock_history', 'GoodsStockHistoryController');

    //操作日志
    Route::resource('operationLog','OperationLogController');

    //退货商品管理
    Route::resource('refund', 'RefundGoodsController');

    //商品备案管理
    Route::get('goodsEorder/toggleShow', ['uses' => 'GoodsEorderController@toggleShow', 'as' => 'admin.goodsEorder.toggleShow']);   //是否展示
    Route::get('goodsEorder/custom_search/{goods_sn}', ['uses' => 'GoodsEorderController@customSearch', 'as' => 'admin.goodsEorder.custom_search']);   //商品海关备案信息查询

    Route::get('goodsEorder/query_stock/{goods_sn}', ['uses' => 'GoodsEorderController@queryStock', 'as' => 'admin.goodsEorder.query_stock']);   //商品在公共仓库存查询

    Route::resource('goodsEorder', 'GoodsEorderController');

    //关键词设置
    Route::post('keywords/sort', ['uses' => 'KeywordsController@sort', 'as' => 'admin.keywords.sort']);
    Route::resource('keywords', 'KeywordsController');

    //账册
    Route::resource('account_books', 'AccountBooksController');

    //产品
    Route::resource('product', 'ProductController');
    //关联产品和商品
    Route::post('product/{product_id}/{goods_id}', ['uses' => 'ProductController@storeSku', 'as' => 'admin.product.storeSku']);
    //产品关联商品时的商品搜索
    Route::get('product/searchGoods/{product_id}', ['uses' => 'ProductController@searchGoods', 'as' => 'admin.product.searchGoods']);
    Route::get('goods/is_has_goods/{good_id}', ['uses' => 'GoodsController@isHasGoods', 'as' => 'admin.goods.isHasGoods']);  //判断商品是否存在

    //优惠券['uses' => 'GoodsEorderController@toggleShow', 'as' => 'admin.goodsEorder.toggleShow']
    Route::resource('coupon', 'CouponController');
    Route::get('coupon_message', ['uses' => 'MassMessageController@index','as' => 'admin.coupon.couponMessage']);
    Route::put('mass_message', ['uses' => 'MassMessageController@sendMassMessage','as' => 'admin.coupon.massMessage']);

    //限时折扣
    Route::resource('discount', 'DiscountController');

    //短信管理
    Route::post('message/send',['uses' => 'MessageController@sendMessage','as' => 'admin.message.sendMessage'] );
    Route::resource('message', 'MessageController');

/*    //口令优惠券
    Route::resource('password_coupon', 'PasswordCouponController');

    //生成口令并且对应优惠券
    Route::post('password_coupon/create_pwd/{pwd_num}/{coupon_id}',  ['uses' => 'PasswordCouponController@createPwds', 'as' => 'admin.password_coupon.create_pwd']);

    //获取指定优惠券的口令
    Route::post('password_coupon/get_pwds_by_coupon_id',  ['uses' => 'PasswordCouponController@getPwdsByCouponId', 'as' => 'admin.password_coupon.get_pwds_by_coupon_id']);

    //获取未发送过的口令的优惠券列表
    Route::post('password_coupon/get_coupon_no_send',  ['uses' => 'PasswordCouponController@getCouponNoSend', 'as' => 'admin.password_coupon.get_coupon_no_send']);

    //发送优惠码给用户
    Route::post('password_coupon/send_pwds_to_user',  ['uses' => 'PasswordCouponController@sendPwdsToUser', 'as' => 'admin.password_coupon.send_pwds_to_user']);
*/

    //git 自动部署

    Route::get('git/deploy','GitController@deploy');
    Route::get('git/tags','GitController@tags');


});



//商铺后台路由

Route::resource('shop_admin/login', 'ShopAdmin\LoginController', ['only' => ['index', 'store', 'destroy']]);//商铺后台登录

Route::get('shop_admin/captcha/{tmp}', 'ShopAdmin\LoginController@captcha');//商铺后台登录验证码

Route::group(['prefix' => 'shop_admin', 'namespace' => 'ShopAdmin', 'middleware' => ['shop_admin']], function () {

    // Route::get('/', ['as' => 'shop_admin.home', 'uses' => 'HomeController@index']);//商铺后台首页

    Route::get('/', ['as' => 'shop_admin.goods', 'uses' => 'GoodsController@index']);//商铺后台首页


    //商铺后台商品

    Route::resource('goods', 'GoodsController');

    Route::put('goods_sort', ['uses' => 'GoodsController@sort', 'as' => 'shop_admin.goods.sort']);  //商品排序

    Route::get('goods/update_one/{good_id}', ['uses' => 'GoodsController@updateOne', 'as' => 'shop_admin.goods.updateOne']);  //商品上下架切换

    Route::get('goods/{good_id}/{name}/update_two', ['uses' => 'GoodsController@updateTwo', 'as' => 'shop_admin.goods.updateTwo']);  //商品上下架切换

    Route::get('goods/stock/{good_sn}', ['uses' => 'GoodsController@updateStock', 'as' => 'shop_admin.goods.updateStock']);  //商品库存变动


    //商铺后台订单

    Route::resource('order', 'OrderController');

    Route::get('order/detail/{order_identification}', ['uses' => 'OrderController@detail', 'as' => 'shop_admin.order.detail']);       //订单详情
    Route::resource('file_upload', 'FileUploadController');
    // Route::post('file_upload', 'FileUploadController@store');

    //商品分类下的品牌

    Route::resource('categoryBrand', 'CategoryBrandController');

    Route::resource('file_upload', 'FileUploadController');
    // Route::post('file_upload', 'FileUploadController@store');

    //商品分类下的品牌

    Route::resource('categoryBrand', 'CategoryBrandController');


});




//接口
Route::group(['prefix' => 'api', 'namespace' => 'Api\V1', 'middleware' => []], function () {



    Route::post('cat/get_child_and_brand/{cat_id}','CatController@getChildAndBrand'); //获取子分类和推荐品牌
    Route::post('shop','ShopController@index'); //店铺页

    Route::post('session','SessionController@index');

    //Route::post('captcha/{tmp}', 'UserController@captcha');//图片验证码
    Route::post('user/sms','UserController@sms'); //发送短信
    Route::post('user/reg','UserController@reg'); //用户注册
    Route::post('user/validate_reg_code','UserController@validateRegCode'); //用户注册验证手机号
    Route::post('user/login','UserController@login'); //用户登录
    Route::post('user/logout','UserController@logout'); //用户退出
    Route::post('user/find_password','UserController@findPaw'); //找回密码
    Route::post('user/update_password','UserController@updatePaw'); //修改密码

    Route::post('login','LoginController@login');
    Route::post('login_out','LoginController@loginOut');

    Route::post('goods/get/{goods_id}','GoodsController@get'); //获取单个商品信息
    Route::post('goods/goods_gallery/{goods_id}','GoodsController@getGoodsGallery'); //获取商品图集
    Route::post('goods/goods_comment','GoodsController@getGoodsComments'); //获取商品评论
    Route::post('goods/get_cat_goods/{cat_id}','GoodsController@getCatGoods'); //根据分类ID获取商品
    Route::post('goods/shop_goods/{shop_id}','GoodsController@getGoodsByShop'); //根据店铺ID获取店铺商品
    Route::post('goods/similar_goods/{goods_id}','GoodsController@getSimilar'); //获取相似商品
    Route::post('goods/get_redirect_goods/{goods_id}','GoodsController@getRedirectGoods'); //根据选择的属性定位对应的商品
    Route::post('goods/get_product_sku/{goods_id}','GoodsController@getProductSku'); //根据商品ID获取商品sku


    Route::post('search/search_cat_goods/{cat_id}','SearchController@searchCatGoods'); //根据筛选获取分类商品
    Route::post('search/search_keyword_goods','SearchController@searchKeywordGoods'); //根据关键词搜索商品

    Route::post('cat/get_tree','CatController@getTree'); //获取所有分类
    Route::post('cat/get_top','CatController@getTop'); //获取顶级分类
    Route::post('cat/get_child/{cat_id}','CatController@getChild'); //获取子分类
    Route::post('cat/get/{cat_id}','CatController@getByCatId'); //根据分类ID获取分类信息
    Route::post('cat/get_attribute/{cat_id}','CatController@getCategoryAttribute'); //根据分类ID获取分类属性

    Route::post('brand/cat_recommend_brand/{cat_id}','BrandController@getCatRecommendBrands'); //获取分类下的推荐品牌


    Route::post('comment/get_comment','CommentController@getComment'); //获取商品评论
    Route::post('comment/count_comment/{goods_id}','CommentController@countComment'); //统计商品所有评论
    Route::post('comment/count_good_comment/{goods_id}','CommentController@countGoodComment'); //统计商品好评
    Route::post('comment/count_middle_comment/{goods_id}','CommentController@countMiddleComment'); //统计商品中评
    Route::post('comment/count_bad_comment/{goods_id}','CommentController@countBadComment'); //统计商品差评


    Route::post('get_ads/{position_key}','AdController@getAds'); //获取广告
    Route::post('activity/get_recommend_activity','ActivityController@getRecommendActivity'); //获取推荐活动
    Route::post('activity/get_activity/{activity_id}','ActivityController@getActivity'); //根据活动ID获取活动信息
    Route::post('activity/get_activity_by_identification/{identification}','ActivityController@getActivityByIdentification'); //根据活动标识获取活动信息
    Route::post('activity/get_activity_cat_goods/{activity_cat_id}','ActivityController@getActivityGoods'); //获取活动专题商品


    Route::post('recommend/get_recommend_position/{identification}','RecommendController@getRecommendPosition'); //根据标识位获取推荐位置
    Route::post('recommend/get_recommend_goods/{identification}','RecommendController@getRecommendGoods'); //根据标识位获取推荐商品
    Route::post('recommend/get_all_recommend','RecommendController@getAllRecommend'); //获取所有推荐

//    Route::post('cat/{cat_id}','CatController@index');
//    Route::post('cat/getChildAndBrand/{cat_id}','CatController@getChildAndBrand');
//    Route::post('collection','CollectionController@index');
//    Route::post('user_center','UserCenterController@index');
//    Route::post('shop','ShopController@index');
//    Route::post('goods/{goods_id}','GoodsController@index');
    Route::post('goods_comment','GoodsController@getGoodsComments');

    //获取购物车商品
    Route::post('cart/get_cart_goods', 'CartController@getCartGoods');
    //添加商品到购物车
    Route::post('cart/add_goods', 'CartController@addGoods');
    //删除购物车中商品
    Route::post('cart/remove_goods', 'CartController@removeGoods');
    //获取购物车详情
    Route::post('cart/get_info', 'CartController@getInfo');
    //获取商品数组中商品总数、总价、总关税等信息
    Route::post('cart/get_goods_info', 'CartController@getGoodsInfo');
    //更新购物车中商品数量
    Route::post('cart/update_number', 'CartController@updateNumber');

    //批量更新购物车中商品
    Route::post('cart/update_batch', 'CartController@updateBatch');

    //支付异步回调接口
    Route::post('pay/alipay_notify','PayController@alipayNotify');


    Route::group(['middleware' => ['apiUser']], function () {

        //游客用户转化为登陆用户
        Route::post('cart/link_session_to_user', 'CartController@linkSessionToUser');

        //订单确认
        Route::post('order/order_confirm', 'OrderController@orderConfirm');
        //创建订单
        Route::post('order/create_order', 'OrderController@createOrder');
        //根据条件获取订单
        Route::post('order/get_orders_by_condations', 'OrderController@getOrdersByCondations');
        //取消订单
        Route::post('order/cancel', 'OrderController@cancel');
        //删除订单
        Route::post('order/destory', 'OrderController@destory');
        //统计订单
        Route::post('order/statistics_order', 'OrderController@statisticsOrder');
        //获取订单商品
        Route::post('order/get_order_goods', 'OrderController@getOrderGoods');
        //统计订单商品总数量
        Route::post('order/statistics_order_goods', 'OrderController@statisticsOrderGoods');
        //获取订单所属商铺
        Route::post('order/get_orders_shop', 'OrderController@getOrdershop');
        //根据订单id获取订单
        Route::post('order/get_by_order_id', 'OrderController@getByOrderId');
        //确认收货
        Route::post('order/recive_goods', 'OrderController@reciveGoods');
        //支付成功后回调
        Route::post('order/order_pay_back', 'OrderController@orderPayBack');
        //获取订单快照
        Route::post('order/get_goods_archive', 'OrderController@getGoodsArchive');

        //创建售后单
        Route::post('refund/create_return_goods', 'RefundGoodsController@createReturnGoods');
        //根据售后单编号查询售后详情
        Route::post('refund/get_by_refund_sn', 'RefundGoodsController@getByRefundSn');
        //根据订单号和订单商品编码获取服务单信息
        Route::post('refund/get_by_order_sn_goods_sn', 'RefundGoodsController@getByOrderSnGoodsSn');
        //根据订单id获取订单、订单商品以及订单商品是否可以售后和售后状态.
        Route::post('refund/get_order_goods_refund_info_by_order_id', 'RefundGoodsController@getOrderGoodsRefundInfoByOrderId');

        //获取用户收货地址
        Route::post('address/get_user_address', 'AddressController@getUserAddress');
        //根据收货地址id获取收货地址
        Route::post('address/get_address', 'AddressController@getAddress');
        //添加收货地址
        Route::post('address/add_address', 'AddressController@addAddress');
        //删除收货地址
        Route::post('address/remove_address', 'AddressController@removeAddress');
        //修改收货地址
        Route::post('address/update_address', 'AddressController@updateAddress');
        //获取用户默认地址
        Route::post('address/get_user_default_address', 'AddressController@getUserDefaultAddress');

        Route::post('comment/create_comment','CommentController@createComment'); //创建评论
        Route::post('file_upload','FileUploadController@fileUpload'); //上传文件

        Route::post('user/user_center','UserController@index'); //用户中心页
        Route::post('collection','CollectionController@index'); //根据收藏类型获取收藏
        Route::post('collection/add','CollectionController@add'); //添加收藏
        Route::post('collection/cancel','CollectionController@cancel'); //取消收藏

        Route::post('pay/alipay_pay','PayController@alipayPay'); //支付接口

        Route::post('coupon/get_coupon','CouponController@getCoupon'); //获取用户优惠券(可加入条件筛选)
        Route::post('coupon/receive_coupon','CouponController@receiveCoupon'); //用户领取优惠券

    });


});


Route::get('test','Front\TestController@index');
Route::get('api_client','Front\ApiClientController@index');
Route::post('api_client/request_ok','Front\ApiClientController@requestOk');
Route::get('schema','Front\SchemaController@index');
Route::get('git','Front\GitController@version');




